﻿package mortal.game.view.mainUI.selectAvatar
{
    import mortal.game.manager.*;
    import mortal.game.scene3D.player.info.*;
    import mortal.game.view.mainUI.*;
    import mortal.game.view.mainUI.avatar.*;
    import mortal.mvc.core.*;

    public class SelectAvatarView extends View
    {
        private var _baseAvatar:BaseAvater;
        private var _bossAvatar:BossAvatar;
        private var _petAvatar:PetEntityAvatar;
        private var _userAvatar:PlayerAvatar;
        private var _monsterAvatar:EntityAvatar;
        private var _robotAvatar:RobotAvatar;
        private var _mercenaryAvatar:MercenaryAvatar;
        private var _lastAvatar:BaseAvater;

        public function SelectAvatarView()
        {
            isHideDispose = false;
            this.layer = LayerManager.uiLayer;
            return;
        }// end function

        public function showBaseAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._baseAvatar)
            {
                this._baseAvatar = new BaseAvater();
            }
            this.addChild(this._baseAvatar);
            this._lastAvatar = this._baseAvatar;
            this.updateEntity(param1);
            this._baseAvatar.y = -30;
            return;
        }// end function

        public function showPetAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._petAvatar)
            {
                this._petAvatar = new PetEntityAvatar();
            }
            this.addChild(this._petAvatar);
            this._lastAvatar = this._petAvatar;
            this.updateEntity(param1);
            return;
        }// end function

        public function showMonsterAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._monsterAvatar)
            {
                this._monsterAvatar = new EntityAvatar();
            }
            this.addChild(this._monsterAvatar);
            this._lastAvatar = this._monsterAvatar;
            this.updateEntity(param1);
            this._monsterAvatar.y = -30;
            return;
        }// end function

        public function showBossAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._bossAvatar)
            {
                this._bossAvatar = new BossAvatar();
            }
            this.addChild(this._bossAvatar);
            this._lastAvatar = this._bossAvatar;
            this.updateEntity(param1);
            return;
        }// end function

        public function showMercenaryAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._mercenaryAvatar)
            {
                this._mercenaryAvatar = new MercenaryAvatar();
            }
            this.addChild(this._mercenaryAvatar);
            this._lastAvatar = this._mercenaryAvatar;
            this.updateEntity(param1);
            return;
        }// end function

        public function showUseAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._userAvatar)
            {
                this._userAvatar = new PlayerAvatar();
            }
            this.addChild(this._userAvatar);
            this._lastAvatar = this._userAvatar;
            this.updateEntity(param1);
            return;
        }// end function

        public function showRobotAvatar(param1:EntityInfo) : void
        {
            this.removeLastAvatar();
            if (!this._robotAvatar)
            {
                this._robotAvatar = new RobotAvatar();
            }
            this.addChild(this._robotAvatar);
            this._lastAvatar = this._robotAvatar;
            this.updateEntity(param1);
            return;
        }// end function

        public function removeLastAvatar() : void
        {
            if (this._lastAvatar && this._lastAvatar.parent)
            {
                this.removeChild(this._lastAvatar);
            }
            return;
        }// end function

        public function updateEntity(param1:EntityInfo) : void
        {
            this._lastAvatar.updateEntity(param1);
            return;
        }// end function

        override public function stageResize() : void
        {
            this.x = 350;
            this.y = 50;
            return;
        }// end function

    }
}
